package com.wimcorp.magic.board;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.ManyToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;

import com.wimcorp.magic.cards.PlayingCard;

@Entity
@Table(name = "playingdeck_playingcard")
@IdClass(PlayingDeckPlayingCardId.class)
public class PlayingDeckPlayingCard {

	@Id
	private long playingdeckId;
	
	@Id
	private long playingcardId;

	private int count;
	@ManyToOne(fetch = FetchType.EAGER)
	@PrimaryKeyJoinColumn(name = "playingdeckId", referencedColumnName = "id")
	private PlayingDeck playingDeck;
	@ManyToOne(fetch = FetchType.EAGER)
	@PrimaryKeyJoinColumn(name = "playingcardId", referencedColumnName = "id")
	private PlayingCard playingCard;

	protected PlayingDeckPlayingCard(){}
	
	public PlayingDeckPlayingCard(PlayingDeck playingDeck,PlayingCard playingCard, int count) {
		this.playingDeck = playingDeck;
		this.playingCard = playingCard;
		this.playingdeckId = playingDeck.getId();
		this.playingcardId = playingCard.getId();
		this.count = count;
	}
	
	
	public int getCount() {
		return count;
	}

	public PlayingDeck getPlayingDeck() {
		return playingDeck;
	}

	public PlayingCard getPlayingCard() {
		return playingCard;
	}
	
	

}
